﻿namespace Morning_4Feb2013
{
    using System;
    using System.Text;

    internal class ConsoleJustification
    {
        // 1.3.2.1.04. http://bgcoder.com/Contests/Practice/Index/52#3

        private static void Main()
        {
            short linesCount = short.Parse(Console.ReadLine());
            short widthLines = short.Parse(Console.ReadLine());
            StringBuilder sb = new StringBuilder(100);
            
            for (int i = 0; i < linesCount; i++)
            {
                string inputText = Console.ReadLine();
                string[] splittedText = inputText.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
                foreach (var word in splittedText)
                {
                    sb.Append(word.ToString());
                    sb.Append(' ');
                }
            }

        }
    }
}